<%@page contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8" trimDirectiveWhitespaces="true"%>
<%@include file="layout/taglib.jsp" %>

<%--<%String ecode=""; 
<%if(request.getParameter("ecode")!=null) %>
<% if(request.getParameter("ecode").equals("135")) %>
<% 	ecode="<div>회원정보는 로그인 하셔야 볼 수 있어요!</div>";%>--%>

<c:if test="${param.ecode eq '135'}">
	<c:set var="ecode">
	<div style="font-size:2em;color:red;font-weight:bold;width:600px;">회원정보는 로그인 하셔야 볼 수 있어요!</div>
	</c:set>
	
</c:if> 

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>::JSP 프로젝트 v1::</title>
<link href="css/normalize.css" rel="stylesheet">
<link href="css/dasom.css" rel="stylesheet">
<style type="text/css">
	/*로그인 폼 정렬*/
	#loginfrm{/*border:1px solid red;*/ width:365px;}
	#loginfrm label{display:inline-block; width:120px;
					text-align:right; font-weight:bold;
					padding:0 10px 0 0;}
	#loginfrm div{margin:10px 10px;}
	
</style>
</head>
<body>

<jsp:include page="layout/header.jsp"/>

	<div id="contents">
	<h2>::로그인::</h2>
		<form name="loginfrm" id="loginfrm" class="centerme">
		<%//=ecode %>${ecode}<%--오류코드에 따른 메세지 출력기능 --%>
			<div><label for="userid">아이디</label>
			<input type="text" name="userid" id="userid"></div>
			
			<div><label for="passwd">비밀번호</label>
			<input type="password" name="passwd" id="passwd"></div>
			
			
			<div><label></label>
			<button type="button" id=loginokbtn>로그인</button>
			<button type="reset">다시입력</button></div>
			
		</form>
	</div>
	<jsp:include page="layout/footer.jsp"/>
	
	<script type="js/jquery-1.11.1.min.js"></script>
	<script type="js/dasom.js"></script>
	<script type="text/javascript">
	
	//로그인 버튼을 클릭 onclick하면 loginme()함수실행
		var loginbtn=document.getElementById("loginokbtn");
		loginbtn.onclick=function(){loginme();};
	
	
	
	
	</script>
	<script type="text/javascript">
	//로그인폼loginfrm에 아이디userid,비밀번호passwd가 입력되었는지 확인하고, 폼 입력값을 post 방식으로 loginok.jsp로 요청submit함
	function loginme(){
		var loginfrm=document.getElementById("loginfrm");
		if(loginfrm.userid.value=="")
			alert('아이디를 입력하세요!');
		else if(loginfrm.passwd.value=="")
			alert('비밀번호를 입력하세요!');
		else{
			loginfrm.method='post';
			loginfrm.action="loginok.jsp";
			loginfrm.submit();
		}
	}
	
	</script>
</body>
</html>
